#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
    string str, stack;
    cin >> str;
    if (str.empty()) cout << "0";
    for (auto& c : str) {
        if (!stack.empty() && stack.back() == c) {
            stack.pop_back();
        }
        else stack.push_back(c);
    }
    if (!stack.empty()) cout << stack;
    else cout << "0";
    return 0;
}